// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="SiblingCondition.cs" company="Scrum for Team System">
//   None
// </copyright>
// <summary>
//   Defines the SiblingComparisonType type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace ScrumForTeamSystem.EventService.TransitionService.DataStructures
{
    using System.Collections.ObjectModel;
    using System.Xml.Serialization;

    /// <summary>
    /// The sibling comparison type.
    /// </summary>
    public enum SiblingComparisonType
    {
        /// <summary>
        /// All siblings must equal the indicated value.
        /// </summary>
        All = 0,

        /// <summary>
        /// Any sibling must equal the indicated value.
        /// </summary>
        Any = 1
    }

    /// <summary>
    /// Defines the SiblingCondition type.
    /// </summary>
    public class SiblingCondition
    {
        /// <summary>
        /// The excluded states collection.
        /// </summary>
        private readonly Collection<string> excludedStates = new Collection<string>();

        /// <summary>
        /// Gets or sets the type of the comaparison.
        /// </summary>
        /// <value>The type of the comaparison.</value>
        [XmlAttribute(AttributeName = "comparison")]
        public SiblingComparisonType ComparisonType
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the link.
        /// </summary>
        /// <value>The work item link.</value>
        [XmlAttribute(AttributeName = "link")]
        public string LinkTypeName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the name of the field.
        /// </summary>
        /// <value>The name of the field.</value>
        [XmlAttribute(AttributeName = "field")]
        public string FieldName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the comparison value.
        /// </summary>
        /// <value>The comparison value.</value>
        [XmlAttribute(AttributeName = "value")]
        public string ComparisonValue
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the name of the sibling type.
        /// </summary>
        /// <value>The name of the sibling type.</value>
        [XmlAttribute(AttributeName = "siblingtype")]
        public string SiblingTypeName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the excluded states.
        /// </summary>
        /// <value>The excluded states.</value>
        [XmlArray]
        [XmlArrayItem(ElementName = "State")]
        public Collection<string> ExcludedStates
        {
            get
            {
                return this.excludedStates;
            }
        }
    }
}
